package ThreadDemo;

import lombok.extern.slf4j.Slf4j;

/**
 * @author wang'ji'cheng
 * @date 2025/7/30
 */
@Slf4j
public class Demo4 {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            log.info("running");
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                System.out.println("111");
            }
        }, "t1");
        t1.start();
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        t1.interrupt();
    }
}
